package com.demo.spzx.manager.controller;




import com.demo.spzx.manager.service.SysUserService;
import com.demo.spzx.model.dto.system.LoginDto;
import com.demo.spzx.model.vo.common.Result;
import com.demo.spzx.model.vo.common.ResultCodeEnum;
import com.demo.spzx.model.vo.system.LoginVo;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Tag(name = "用户接口")
@RestController
@RequestMapping(value = "/admin/system/index")
public class IndexController {

    @Autowired
    private SysUserService sysUserService;


    @PostMapping("login")
    public Result<LoginVo> loginVo(@RequestBody LoginDto loginDto , HttpServletRequest request){

        String ip=request.getRemoteAddr();
        LoginVo loginVo=sysUserService.login(loginDto,ip);
        return Result.build(loginVo, ResultCodeEnum.SUCCESS);
    }




}
